home *** CD-ROM | disk | FTP | other *** search
/ Amoszine PD Edition 0 / Amoszine PD Edition 0.adf / SOURCE_CODE / NO_DOS.AMOS / NO_DOS.amosSourceCode
AMOS Source Code  |  1993-02-25  |  21KB  |  693 lines

  1. '
  2. '
  3. '
  4. 'I whipped this off Issue one of DIDSMAG a new Amos disk mag 
  5. 'It's free if you send a couple of disks to :
  6. 'Richard Martin, 9 Blundell Avenue, Birkdale, Southport. PR8-4TA 
  7. '
  8. 'thanks richard
  9. '
  10. '
  11. Rem A library for WB2 style window and requesters
  12. Rem  
  13. Rem with a bit of imagination, you can do anything!  
  14. Rem
  15. Rem And all with humble AMOS.
  16. Rem
  17.  
  18. Rem Before, you could tell a serious AMOS program a mile away  
  19. Rem because of the disgusting interface AMOS provided. 
  20. Rem Now you can even conform to Commodore's interface guidelines!
  21. Rem And best off all, no one can tell your program is written in AMOS! 
  22.  
  23. Proc INITIALISE : Rem ** Opens a screen and defines colours etc. 
  24.  
  25. Rem  ** This line draws a demo requester message 
  26. Proc REAL3DMESSAGE[170,71,305,80,True,20,25,"An example message","You can create all sorts of   ","messages and requesters that  ","look just like the real       ","thing, and no nasty DOS calls!","","","","Ok",""]
  27.  
  28. Rem --- Main Loop, controls button checking and stuff ---
  29. Repeat 
  30.    If Mouse Key=1 and Mouse Zone=1 : Rem ** Wait for the OK box to be clicked on  
  31.       Proc CLICKBOX[(305-40)/2+170,80+71-17,40,13,True,"Ok",0,False] : Rem ** Draw it embossed  
  32.       Repeat : Until Mouse Key=0 : Rem   ** Wait for the user to release the mouse button 
  33.       Rem                                ** Draw over the window in grey so it goes away 
  34.       Ink 2
  35.       Bar 170,71 To 170+305,71+80
  36.  
  37.       Proc EXAMPLEWINDOW : Rem           ** Draw the screenmode requester 
  38.       Repeat : Until Mouse Key=1 : Rem   ** Wait for user to click mouse button 
  39.       End : Rem                          ** Then, end.   
  40.    End If 
  41. Until False
  42.  
  43.  
  44. Rem --- This is an example of the kind of thing you can produce
  45. Procedure EXAMPLEWINDOW
  46.    VISIBLE$="320 x   256"
  47.    MYNIMUM$="320 x   256"
  48.    MEXIMUM$="16368 x 16384"
  49.    MEXCOLS$="4096         "
  50.  
  51.    X=19
  52.    Y=34
  53.  
  54.    Proc REAL3DWINDOW[X,Y,603,194,False,"Look familiar?","Save","Cancel",80,10]
  55.    Proc HEAVYICON[X+12,Y+29,276,75,False,0,False]
  56.    Proc HEAVYICON[X+14+276,Y+29,15,75,False,0,False]
  57.  
  58.    Ink 0
  59.    Bar X+16+278,Y+31 To X+24+278,Y+31+71
  60.  
  61.    Ink 0
  62.    Text 125,Y+22,"Display Mode"
  63.    Text 410,Y+22,"Mode properties"
  64.    Text X+329,Y+40,"Visible Size  :   "+VISIBLE$
  65.    Text X+329,Y+49,"Minimum Size  :   "+MYNIMUM$
  66.    Text X+329,Y+58,"Maximum Size  : "+MEXIMUM$
  67.    Text X+329,Y+67,"Maximum Colors: "+MEXCOLS$
  68.    Text X+329,Y+85,"50Hz, 15.60kHz"
  69.  
  70.    Text X+16,Y+37,"PAL:High Res"
  71.    Text X+16,Y+46,"PAL:High Res Laced"
  72.    Text X+16,Y+55,"PAL:Low Res"
  73.    Text X+16,Y+64,"PAL:Low Res Laced"
  74.    Text X+16,Y+73,"PAL:Super-High Res"
  75.    Text X+16,Y+82,"PAL:Super-High Res Laced"
  76.  
  77.    Text X+56,Y+118,"Width:"
  78.    Text X+56-8,Y+133,"Height:"
  79.    Text X+56-8,Y+152,"Colors:"
  80.    Text X+16,Y+168,"AutoScroll:"
  81.  
  82.    Proc ENTERBOX[X+110,Y+108,65,13,0,False]
  83.    Proc ENTERBOX[X+110,Y+124,65,13,0,False]
  84.  
  85.    Proc TICKBOX[X+182,Y+110,True,0,False]
  86.    Proc TICKBOX[X+182,Y+126,True,0,False]
  87.    Proc TICKBOX[X+110,Y+160,True,0,False]
  88.  
  89.    Text X+212,Y+118,"Default"
  90.    Text X+212,Y+134,"Default"
  91.  
  92.    Proc SLIDER[X+130,Y+144,170,0,0,False]
  93.    Proc HEAVYICON[X+318,Y+29,273,141,True,0,False]
  94.  
  95.    Proc HEAVYCLICKBOX[(603-80)/2+19,194+34-19,80,13,False,"Use",0,False]
  96. End Proc
  97.  
  98.  
  99. Rem --- The library definitions start from here ---------------
  100. Procedure REAL3DMESSAGE[X,Y,WIDTH,HIGHT,INSIDEPATTERN,XPOS,YPOS,TITLE$,LINE1$,LINE2$,LINE3$,LINE4$,LINE5$,LINE6$,LINE7$,BUTTON1$,BUTTON2$]
  101.    Rem ** X             = The x possition of the window 
  102.    Rem ** Y             = The y possition of the window 
  103.    Rem ** WIDTH         = The width of the window 
  104.    Rem ** HIGHT         = The height of the window
  105.    Rem ** INSIDEPATTERN = Whether there is a dithered pattern inside the window 
  106.    Rem It requires you to specify True, or False
  107.  
  108.    Rem ** XPOS          = The x possition of the text (if any) inside the window
  109.    Rem ** YPOS          = The y possition of the text (if any) inside the window
  110.    Rem ** TITLE$        = The title of the window 
  111.    Rem ** LINE1$        = Line 1 of the message (can just be "" for no message) 
  112.    Rem ** LINE2$        = Line 2 of the message (can just be "" for no message)   
  113.    Rem ** LINE3$        = Line 3 of the message (can just be "" for no message)   
  114.    Rem ** LINE4$        = Line 4 of the message (can just be "" for no message)   
  115.    Rem ** LINE5$        = Line 5 of the message (can just be "" for no message) 
  116.    Rem ** LINE6$        = Line 6 of the message (can just be "" for no message)     
  117.    Rem ** LINE7$        = Line 7 of the message (can just be "" for no message)   
  118.    Rem ** BUTTON1$      = The first of the buttons (can just be "" for no button) 
  119.    Rem ** BUTTON2$      = The last of the buttons (if this is just "" then the first button will be centered) 
  120.  
  121.    Reserve Zone 3
  122.  
  123.    Gr Writing 0
  124.  
  125.    TXTYPOS=Y+YPOS
  126.    
  127.    Get Block 1,X,Y,WIDTH+1,HIGHT+1
  128.    Ink 2 : Bar X,Y To X+WIDTH,Y+HIGHT
  129.    
  130.    Ink 1
  131.    
  132.    Draw X,Y+HIGHT To X,Y
  133.    Draw X,Y To X+WIDTH,Y
  134.    
  135.    Ink 0
  136.    Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT
  137.    Draw X+WIDTH,Y+HIGHT To X+1,Y+HIGHT
  138.    
  139.    Ink 0
  140.    Draw X+3,Y+HIGHT-1 To X+3,Y+10
  141.    Draw X+3,Y+10 To X+WIDTH-4,Y+10
  142.    
  143.    Ink 1
  144.    Draw X+WIDTH-3,Y+10 To X+WIDTH-3,HIGHT+Y-1
  145.    Draw X+WIDTH-3,HIGHT+Y-1 To X+4,Y+HIGHT-1
  146.    
  147.    Ink 3
  148.    Bar X+1,Y+1 To X+WIDTH-1,Y+9
  149.  
  150.    Bar X+1,Y+1 To X+2,Y+HIGHT-1
  151.    Bar X+WIDTH-2,Y+1 To X+WIDTH-1,Y+HIGHT-1
  152.  
  153.    If INSIDEPATTERN=True
  154.       Ink 2
  155.       Set Pattern 2
  156.       Paint X+5,Y+15
  157.  
  158.       Ink 0
  159.       Draw X+8,Y+HIGHT-19 To X+8,Y+13
  160.       Draw X+8,Y+13 To X+WIDTH-8,Y+13
  161.       
  162.       Ink 1
  163.       Draw X+WIDTH-8,Y+13 To X+WIDTH-8,Y+HIGHT-19
  164.       Draw X+WIDTH-8,Y+HIGHT-19 To X+8,Y+HIGHT-19
  165.       
  166.       Set Pattern 0
  167.       
  168.       Ink 2
  169.       Bar X+9,Y+14 To X+WIDTH-9,Y+HIGHT-20
  170.    End If 
  171.  
  172.    If LINE1$<>""
  173.       Ink 0
  174.       
  175.       Text(WIDTH-Len(LINE1$)*8)/2+X,TXTYPOS,LINE1$
  176.       TXTYPOS=TXTYPOS+9
  177.       Text(WIDTH-Len(LINE2$)*8)/2+X,TXTYPOS,LINE2$
  178.       TXTYPOS=TXTYPOS+9
  179.       Text(WIDTH-Len(LINE3$)*8)/2+X,TXTYPOS,LINE3$
  180.       TXTYPOS=TXTYPOS+9
  181.       Text(WIDTH-Len(LINE4$)*8)/2+X,TXTYPOS,LINE4$
  182.       TXTYPOS=TXTYPOS+9
  183.       Text(WIDTH-Len(LINE5$)*8)/2+X,TXTYPOS,LINE5$
  184.       TXTYPOS=TXTYPOS+9
  185.       Text(WIDTH-Len(LINE6$)*8)/2+X,TXTYPOS,LINE6$
  186.       TXTYPOS=TXTYPOS+9
  187.       Text(WIDTH-Len(LINE7$)*8)/2+X,TXTYPOS,LINE7$
  188.    End If 
  189.    
  190.    If BUTTON2$=""
  191.       Proc CLICKBOX[(WIDTH-40)/2+X,HIGHT+Y-17,40,13,False,BUTTON1$,1,True]
  192.    End If 
  193.    
  194.    If BUTTON2$<>""
  195.       Proc CLICKBOX[X+8,Y+HIGHT-17,40,13,False,BUTTON1$,1,True]
  196.       Proc CLICKBOX[WIDTH+X-78,Y+HIGHT-17,70,13,False,BUTTON2$,2,True]
  197.    End If 
  198.    Ink 0
  199.    Text X+4,Y+7,TITLE$
  200. End Proc
  201.  
  202.  
  203. Procedure SLIDER[X,Y,WIDTH,XBAR,ZHONENUMBER,SETUPZONE]
  204.    Rem ** X           = x possition of the slider box   
  205.    Rem ** Y           = y possition of the slider box 
  206.    Rem ** WIDTH       = width of the slider box 
  207.    Rem ** XBAR        = the x possition of the bar inside the slider border 
  208.    Rem ** ZHONENUMBER = the number of the zone to be defined (if a zone is going to be set up)
  209.    Rem ** SETUPZONE   = if a zone is going to be set up the this should be True, if not False 
  210.  
  211.    Proc HEAVYICON[X,Y,WIDTH,10,False,ZHONENUMBER,SETUPZONE]
  212.    Ink 0
  213.    Bar X+4+XBAR,Y+2 To X+3+XBAR+30,Y+8
  214. End Proc
  215.  
  216.  
  217. Procedure ENTERBOX[X,Y,WIDTH,HIGHT,ZHONENUMBER,SETUPZONE]
  218.    Rem ** X           = x possition of the box
  219.    Rem ** Y           = y possition of the box
  220.    Rem ** WIDTH       = width of the box
  221.    Rem ** HIGHT       = height of the box 
  222.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any) 
  223.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  224.  
  225.    Ink 1
  226.    Draw X,Y To X,Y+HIGHT
  227.    Draw X+1,Y To X+1,Y+HIGHT-1
  228.    Draw X+2,Y To X+WIDTH-1,Y
  229.    Draw X+WIDTH-2,Y To X+WIDTH-2,Y+HIGHT-1
  230.    Draw X+WIDTH-3,Y+2 To X+WIDTH-3,Y+HIGHT-1
  231.    Draw X+WIDTH-3,Y+HIGHT-1 To X+3,Y+HIGHT-1
  232.    
  233.    Ink 0
  234.    Draw X+2,Y+1 To X+WIDTH-3,Y+1
  235.    Draw X+2,Y+1 To X+2,Y+HIGHT-1
  236.    Draw X+3,Y+1 To X+3,Y+HIGHT-2
  237.    Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  238.    Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  239.    Draw X+1,Y+HIGHT To X+WIDTH-2,Y+HIGHT
  240.  
  241.    If SETUPZONE=True
  242.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  243.    End If 
  244. End Proc
  245.  
  246.  
  247. Procedure CYCLEBOX[X,Y,WIDTH,HIGHT,POSSITION,EMBOSSED,SETUPZONE,ZHONENUMBER,CYCLE1$,CYCLE2$,CYCLE3$,CYCLE4$]
  248.    Rem ** X           = x possition of the box    
  249.    Rem ** Y           = y possition of the box    
  250.    Rem ** WIDTH       = width of the box    
  251.    Rem ** HIGHT       = height of the box   
  252.    Rem ** POSSITION   = What stage the cyclebox is at 1,2,3 or 4 (what text is being displayed)   
  253.    Rem ** EMBOSSED    = Wheter the cyclebox is embossed or not (True, or False)   
  254.    Rem ** SETUPZONE   = whether a zone is set up (True, or False)   
  255.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any) 
  256.    Rem ** CYCLE1$     = the text that is first displayed
  257.    Rem ** CYCLE2$     = the text that is displayed after 2 clicks   
  258.    Rem ** CYCLE3$     = the text that is displayed after 3 clicks 
  259.    Rem ** CYCLE4$     = the text that is displayed after 4 clicks   
  260.  
  261.  
  262.    If EMBOSSED=False
  263.       Ink 2
  264.       Bar X+3,Y+1 To X+WIDTH-3,Y+HIGHT-1
  265.       Ink 1
  266.       Draw X,Y To X,Y+HIGHT
  267.       Draw X+1,Y+1 To X+1,Y+HIGHT-1
  268.       Draw X,Y To X+WIDTH-1,Y
  269.  
  270.       Ink 0
  271.       Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  272.       Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  273.       Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT
  274.  
  275.       Box X+6,Y+2 To X+15,Y+11
  276.       Draw X+7,Y+2 To X+7,Y+10
  277.       Draw X+14,Y+2 To X+14,Y+10
  278.  
  279.       Ink 0
  280.       Plot X+13,Y+7
  281.       Plot X+16,Y+7
  282.       Plot X+13,Y+6
  283.       Plot X+16,Y+6
  284.       Plot X+12,Y+6
  285.       Plot X+17,Y+6
  286.    Else 
  287.       Ink 2
  288.       Bar X+3,Y+1 To X+WIDTH-3,Y+HIGHT-1
  289.  
  290.       Ink 0
  291.       Draw X,Y To X,Y+HIGHT
  292.       Draw X+1,Y+1 To X+1,Y+HIGHT-1
  293.       Draw X,Y To X+WIDTH-1,Y
  294.  
  295.       Ink 1
  296.       Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  297.       Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  298.       Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT
  299.  
  300.       Box X+6,Y+2 To X+15,Y+11
  301.       Draw X+7,Y+2 To X+7,Y+10
  302.       Draw X+14,Y+2 To X+14,Y+10
  303.  
  304.       Ink 1
  305.       Plot X+13,Y+7
  306.       Plot X+16,Y+7
  307.       Plot X+13,Y+6
  308.       Plot X+16,Y+6
  309.       Plot X+12,Y+6
  310.       Plot X+17,Y+6
  311.    End If 
  312.  
  313.    If SETUPZONE=True
  314.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  315.    End If 
  316.  
  317.    Ink 2
  318.    Plot X+6,Y+2
  319.    Plot X+15,Y+2
  320.    Plot X+15,Y+11
  321.    Plot X+6,Y+11
  322.    Plot X+14,Y+9
  323.    Plot X+15,Y+9
  324.  
  325.    Ink 0
  326.    Draw X+20,Y+2 To X+20,Y+12
  327.    Ink 1
  328.    Draw X+21,Y+2 To X+21,Y+12
  329.  
  330.    Ink 0
  331.    If POSSITION=1 Then Text(WIDTH-Len(CYCLE1$)*8)/2+X,Y+9,CYCLE1$
  332.    If POSSITION=2 Then Text(WIDTH-Len(CYCLE2$)*8)/2+X,Y+9,CYCLE2$
  333.    If POSSITION=3 Then Text(WIDTH-Len(CYCLE3$)*8)/2+X,Y+9,CYCLE3$
  334.    If POSSITION=4 Then Text(WIDTH-Len(CYCLE4$)*8)/2+X,Y+9,CYCLE4$
  335. End Proc
  336.  
  337.  
  338. Procedure TICKBOX[X,Y,TICK,ZHONENUMBER,SETUPZONE]
  339.    Rem ** X           = x possition of the box
  340.    Rem ** Y           = y possition of the box
  341.    Rem ** TICK        = whether the box displays a tick or not (True, or False) 
  342.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any) 
  343.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  344.  
  345.    Ink 1
  346.    Draw X,Y To X+23,Y
  347.    Draw X,Y To X,Y+10
  348.    Draw X+1,Y To X+1,Y+9
  349.    
  350.    Ink 0
  351.    Draw X+24,Y To X+24,Y+10
  352.    Draw X+23,Y+1 To X+23,Y+10
  353.    Draw X+1,Y+10 To X+22,Y+10
  354.  
  355.    If TICK=True
  356.       Ink 0
  357.       Plot X+6,Y+5
  358.       Plot X+7,Y+5
  359.       Plot X+8,Y+5
  360.       Plot X+7,Y+6
  361.       Plot X+8,Y+6
  362.       Plot X+9,Y+6
  363.       Plot X+8,Y+7
  364.       Plot X+9,Y+7
  365.       Plot X+10,Y+7
  366.       Plot X+11,Y+7
  367.       Plot X+12,Y+7
  368.       Plot X+9,Y+8
  369.       Plot X+10,Y+8
  370.       Plot X+11,Y+8
  371.       Plot X+12,Y+6
  372.       Plot X+13,Y+6
  373.       Plot X+13,Y+5
  374.       Plot X+14,Y+5
  375.       Plot X+14,Y+4
  376.       Plot X+15,Y+4
  377.       Plot X+15,Y+3
  378.       Plot X+16,Y+3
  379.       Plot X+16,Y+2
  380.       Plot X+17,Y+2
  381.       Plot X+18,Y+2
  382.    Else 
  383.       Ink 2
  384.       Bar X+2,Y+1 To X+21,Y+8
  385.    End If 
  386.  
  387.    If SETUPZONE=True
  388.       Set Zone ZHONENUMBER,X,Y To X+24,Y+10
  389.    End If 
  390. End Proc
  391.  
  392.  
  393. Procedure HEAVYICON[X,Y,WIDTH,HIGHT,EMBOSSED,ZHONENUMBER,SETUPZONE]
  394.    Rem ** X           = x possition of the box
  395.    Rem ** Y           = y possition of the box
  396.    Rem ** WIDTH       = width of the box    
  397.    Rem ** HIGHT       = height of the box   
  398.    Rem ** EMBOSSED    = whether the box is embossed or not (True, or False) 
  399.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any) 
  400.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  401.  
  402.    If EMBOSSED=False
  403.       Ink 1
  404.       Draw X,Y To X+WIDTH,Y
  405.       Draw X,Y To X,Y+HIGHT
  406.       Draw X+1,Y To X+1,Y+HIGHT-1
  407.    
  408.       Ink 0
  409.       Draw X+WIDTH+1,Y To X+WIDTH+1,Y+HIGHT
  410.       Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT
  411.       Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT
  412.    Else 
  413.       Ink 0
  414.       Draw X,Y To X+WIDTH,Y
  415.       Draw X,Y To X,Y+HIGHT
  416.       Draw X+1,Y To X+1,Y+HIGHT-1
  417.    
  418.       Ink 1
  419.       Draw X+WIDTH+1,Y To X+WIDTH+1,Y+HIGHT
  420.       Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT
  421.       Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT
  422.    End If 
  423.  
  424.    If SETUPZONE=True
  425.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  426.    End If 
  427. End Proc
  428.  
  429.  
  430. Procedure REAL3DWINDOW[X,Y,WIDTH,HIGHT,GADGET,TITLE$,BUTTON1$,BUTTON2$,WIDTHOFBUTTONS,BUTDISTEDGE]
  431.    Rem ** X              = x possition of the window  
  432.    Rem ** Y              = y possition of the window  
  433.    Rem ** WIDTH          = width of the window      
  434.    Rem ** HIGHT          = height of the window   
  435.    Rem ** GADGET         = whether the window has a close gadget or not (True, or False)  
  436.    Rem ** TITLE$         = the title of the window  
  437.    Rem ** BUTTON1$       = the first of the buttons (can just be "" for no button)  
  438.    Rem ** BUTTON2$       = the last of the buttons (if this is just "" then the first button will be centered)  
  439.    Rem ** WIDTHOFBUTTONS = the width of the Ok and Cancel buttons 
  440.    Rem ** BUTDISTEDGE    = the distance from the edge of the window that the buttons are drawn  
  441.  
  442.    Ink 2
  443.    Bar X+3,Y+11 To X+WIDTH-3,Y+HIGHT-2
  444.  
  445.    Ink 1
  446.    Draw X,Y+HIGHT To X,Y
  447.    Draw X,Y To X+WIDTH,Y
  448.    
  449.    Ink 0
  450.    Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT
  451.    Draw X+WIDTH,Y+HIGHT To X+1,Y+HIGHT
  452.    
  453.    Ink 0
  454.    Draw X+3,Y+HIGHT-1 To X+3,Y+10
  455.    Draw X+3,Y+10 To X+WIDTH-4,Y+10
  456.    
  457.    Ink 1
  458.    Draw X+WIDTH-3,Y+10 To X+WIDTH-3,HIGHT+Y-1
  459.    Draw X+WIDTH-3,HIGHT+Y-1 To X+4,Y+HIGHT-1
  460.    
  461.    Ink 3
  462.    Bar X+1,Y+1 To X+WIDTH-1,Y+9
  463.  
  464.    Bar X+1,Y+1 To X+2,Y+HIGHT-1
  465.    Bar X+WIDTH-2,Y+1 To X+WIDTH-1,Y+HIGHT-1
  466.  
  467.    If BUTTON1$<>""
  468.       If BUTTON2$=""
  469.          Proc HEAVYCLICKBOX[(WIDTH-WIDTHOFBUTTONS)/2+X,HIGHT+Y-17,WIDTHOFBUTTONS,13,False,BUTTON1$,0,False]
  470.       End If 
  471.    End If 
  472.  
  473.    If BUTTON2$<>""
  474.       Proc HEAVYCLICKBOX[X+BUTDISTEDGE,Y+HIGHT-19,WIDTHOFBUTTONS,13,False,BUTTON1$,0,False]
  475.       Proc HEAVYCLICKBOX[X+WIDTH-WIDTHOFBUTTONS-BUTDISTEDGE,Y+HIGHT-19,WIDTHOFBUTTONS,13,False,BUTTON2$,0,False]
  476.    End If 
  477.  
  478.    If GADGET=True
  479.       Paper 3
  480.       Ink 0
  481.       Text X+28,Y+7,TITLE$
  482.    Else 
  483.       Paper 3
  484.       Ink 0
  485.       Text X+4,Y+7,TITLE$
  486.    End If 
  487.  
  488.    If GADGET=True
  489.       Proc GADGET[X,Y,False]
  490.    End If 
  491. End Proc
  492.  
  493.  
  494. Procedure GADGET[X,Y,EMBOSSED]
  495.    Rem ** X        = x possition of the gadget  
  496.    Rem ** Y        = y possition of the gadget
  497.    Rem ** EMBOSSED = whether the gadget is embossed or not (True, or False) 
  498.  
  499.    If EMBOSSED=False
  500.       Proc BEVEL[X,Y,18,10,1,False,3]
  501.       Ink 1
  502.       Draw X+19,Y+1 To X+19,Y+9
  503.       Ink 0
  504.       Box X+7,Y+3 To X+11,Y+7
  505.       Ink 1
  506.       Paint X+8,Y+4
  507.    End If 
  508.    If EMBOSSED=True
  509.       Proc BEVEL[X,Y,18,10,1,True,2]
  510.       Ink 0
  511.       Box X+7,Y+3 To X+11,Y+7
  512.       Ink 2
  513.       Paint X+8,Y+4
  514.    End If 
  515. End Proc
  516.  
  517.  
  518. Procedure HEAVYCLICKBOX[X,Y,WIDTH,HIGHT,EMBOSSED,MESSAGE$,ZHONENUMBER,SETUPZONE]
  519.    Rem ** X           = x possition of the box  
  520.    Rem ** Y           = y possition of the box  
  521.    Rem ** WIDTH       = width of the box  
  522.    Rem ** HIGHT       = height of the box 
  523.    Rem ** EMBOSSED    = whether the box is embossed or not (True, or False) 
  524.    Rem ** MESSAGE$    = what text is centered inside the box (if any) 
  525.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any)   
  526.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  527.  
  528.    Set Pattern 0
  529.    If EMBOSSED=False
  530.       Ink 1
  531.       Draw X,Y To X,Y+HIGHT
  532.       Draw X,Y To X+WIDTH-1,Y
  533.       Draw X+1,Y To X+1,Y+HIGHT-1
  534.  
  535.       Ink 0
  536.       Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  537.       Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  538.       Draw X+WIDTH-1,Y+HIGHT To X+1,Y+HIGHT
  539.    Else 
  540.       Ink 0
  541.       Draw X,Y To X,Y+HIGHT
  542.       Draw X,Y To X+WIDTH-1,Y
  543.       Draw X+1,Y To X+1,Y+HIGHT-1
  544.  
  545.       Ink 1
  546.       Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  547.       Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  548.       Draw X+WIDTH-1,Y+HIGHT To X+1,Y+HIGHT
  549.    End If 
  550.    If SETUPZONE=True
  551.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  552.    End If 
  553.  
  554.    Ink 0
  555.    Text(WIDTH-Len(MESSAGE$)*8)/2+X,(Y+HIGHT/2)+3,MESSAGE$
  556. End Proc
  557.  
  558.  
  559. Procedure BEVEL[X,Y,WIDTH,HIGHT,ISITFILLED,EMBOSSED,_FILLCOLOUR]
  560.    Rem ** X           = x possition of the box  
  561.    Rem ** Y           = y possition of the box  
  562.    Rem ** WIDTH       = width of the box  
  563.    Rem ** HIGHT       = height of the box 
  564.    Rem ** ISITFILLED  = whether the box is filled or not (True, or False) 
  565.    Rem ** EMBOSSED    = whether the box is embossed or not (True, or False) 
  566.    Rem ** _FILLCOLOUR = the colour the box is filled with 
  567.  
  568. If EMBOSSED=False
  569.    Ink 1
  570.    Draw X,Y+HIGHT To X,Y
  571.    Draw X,Y To X+WIDTH,Y
  572.  
  573.    Ink 0
  574.    Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  575.    Draw X+WIDTH,Y+HIGHT To X,Y+HIGHT
  576. Else 
  577.    Ink 0
  578.    Draw X,Y+HIGHT To X,Y
  579.    Draw X,Y To X+WIDTH,Y
  580.  
  581.    Ink 1
  582.    Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  583.    Draw X+WIDTH,Y+HIGHT To X,Y+HIGHT
  584. End If 
  585.  
  586. If ISITFILLED=1
  587.    Ink _FILLCOLOUR
  588.    Bar X+1,Y+1 To X+WIDTH-1,Y+HIGHT-1
  589. Else 
  590.  
  591. End If 
  592. End Proc
  593.  
  594.  
  595. Procedure CLICKBOX[X,Y,WIDTH,HIGHT,EMBOSSED,MESSAGE$,ZHONENUMBER,SETUPZONE]
  596.    Rem ** X           = x possition of the box  
  597.    Rem ** Y           = y possition of the box  
  598.    Rem ** WIDTH       = width of the box  
  599.    Rem ** HIGHT       = height of the box 
  600.    Rem ** EMBOSSED    = whether the box is embossed or not (True, or False) 
  601.    Rem ** MESSAGE$    = what text is centered inside the box (if any) 
  602.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any)   
  603.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  604.  
  605.    Set Pattern 0
  606.    Proc BEVEL[X,Y,WIDTH,HIGHT,1,EMBOSSED,2]
  607.  
  608.    If SETUPZONE=True
  609.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  610.    End If 
  611.  
  612.    Ink 0
  613.    Text(WIDTH-Len(MESSAGE$)*8)/2+X,(Y+HIGHT/2)+3,MESSAGE$
  614. End Proc
  615.  
  616.  
  617. Procedure INITIALISE
  618.    Default Palette $0,$FFF,$AAA,$68B
  619.    Screen Open 1,640,256,4,Hires
  620.    Curs Off : Flash Off : Gr Writing 0
  621.  
  622.    Limit Mouse 128,42 To 447,297
  623.  
  624.    Cls 2
  625.    Proc SCREANTITLE["An example screen"]
  626. End Proc
  627.  
  628.  
  629. Procedure SCREANTITLE[SCREANTITLE$]
  630.    Rem ** SCREANTITLE$ = title of the scren 
  631.  
  632.    Gr Writing 0
  633.    Proc BEVEL[0,0,639,10,1,False,1]
  634.    Ink 0
  635.    Text 4,7,SCREANTITLE$
  636. End Proc
  637.  
  638.  
  639. Procedure FINDMOUSELIMIT[X_WINDOW,Y_WINDOW,WIDTH,HIGHT,X_MOUSE,Y_MOUSE]
  640.    Rem ** X_WINDOW = x possition of the window  
  641.    Rem ** Y_WINDOW = y possition of the window  
  642.    Rem ** WIDTH    = width of the window
  643.    Rem ** HIGHT    = height of the window 
  644.    Rem ** X_MOUSE  = x possition of the mouse 
  645.    Rem ** Y_MOUSE  = y possition of the mouse 
  646.  
  647.    Limit Mouse X Hard(0+X_MOUSE-X_WINDOW),Y Hard(0+Y_MOUSE-Y_WINDOW) To X Hard(639-WIDTH-X_WINDOW+X_MOUSE+1),Y Hard(255-HIGHT-Y_WINDOW+Y_MOUSE+1)
  648. End Proc
  649.  
  650.  
  651. Procedure DRAGTHEWINDOW[X,Y,WIDTH,HIGHT,ZHONENUMBER]
  652.    Rem ** X           = x possition of the box  
  653.    Rem ** Y           = y possition of the box  
  654.    Rem ** WIDTH       = width of the box  
  655.    Rem ** HIGHT       = height of the box 
  656.    Rem ** ZHONENUMBER = the number of the zone that is on the title bar 
  657.  
  658.    Get Block 2,X,Y,WIDTH-1,HIGHT : Rem Grabs the window 
  659.  
  660.    _ORIGINALX=X Screen(X Mouse) : Rem This is where the mouse first was when clicked (x coord) 
  661.    _ORIGINALY=Y Screen(Y Mouse) : Rem This is where the mouse first was when clicked (y coord) 
  662.  
  663.    Gr Writing 2 : Rem This line means all drawn objects will be in the opposite colour to whats under them (for the drag box)  
  664.  
  665.    Proc FINDMOUSELIMIT[X,Y,WIDTH,HIGHT,_ORIGINALX,_ORIGINALY] : Rem Finds the mouse limit of the box (so it can go off screen) 
  666.  
  667.    Repeat 
  668.       DRAGX=X+X Screen(X Mouse)-_ORIGINALX : Rem DRAGX is the new x coord for the drag box  
  669.       DRAGY=Y+Y Screen(Y Mouse)-_ORIGINALY : Rem DRAGY is the new y coord for the drag box
  670.  
  671.       Wait Vbl : Rem Wait for monitor sync (stops flicker, almost!) 
  672.       Box DRAGX,DRAGY To DRAGX+WIDTH-1,DRAGY+HIGHT-1 : Rem Draw the drag box  
  673.       Wait Vbl 
  674.       Box DRAGX,DRAGY To DRAGX+WIDTH-1,DRAGY+HIGHT-1 : Rem Undraw the drag box
  675.  
  676.    Until Mouse Key=0 : Rem Repeat until the user releases the mousebutton 
  677.  
  678.    Gr Writing 0 : Rem Turn inverse colour off
  679.    Put Block 1,X,Y : Rem put back what was under the window 
  680.  
  681.    Get Block 1,DRAGX,DRAGY,WIDTH,HIGHT
  682.    Put Block 2,DRAGX,DRAGY : Rem Put the window back after drag 
  683.  
  684.    X=DRAGX : Rem Make X the same as DRAGX 
  685.    Y=DRAGY : Rem Make y the same as DRAGY 
  686.  
  687.    Limit Mouse 128,42 To 447,297 : Rem turn off the mouse limiting
  688.    Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+11 : Rem This sets up the zone at its new possition 
  689. End Proc
  690. Rem --- End of library 
  691.  
  692. Rem Not all the functions have been used in this example,
  693. Rem I have left them for you to discover for yourself...